#include <stdio.h> 
#include <string.h>
#define SIZE 100
// 实现函数，返回字符串中出现次数最多的字符
char find_most_char(const char* str) {
    int max = 0;  
    char max_ch = str[0];  

    int length = strlen(str);

    for (int i = 0; i < length; i++) {
        int count = 0;  // 记录当前字符的出现次数
        char ch = str[i];  // 当前字符

        // 统计当前字符在字符串中出现的次数
        for (int j = 0; j < length; j++) {
            if (str[j] == ch) {
                count++;
            }
        }

        if (count > max) {
            max = count;
            max_ch = ch;
        }
    }

    return max_ch; 
}

int main() {

    char str[SIZE] = { 0 };
    printf("请输入一个字符串：");
    scanf("%s", str);

    char max_ch = find_most_char(str);

    printf("出现最多的是%c\n", max_ch);

    return 0;
}





